package com.qhx.rtkcloud.ntrip;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.*;
import java.util.concurrent.*;

//本地连接云端服务，更改基准站的位置坐标
//@Configuration
public class BaseStationTcpClient {

    public static ExecutorService executorService = Executors.newFixedThreadPool(200);

    @Value("#{${rtk.baseStation.baseStationTcpPorts}}")
    public Map<Integer,Integer> baseStationTcpPorts;


    @Bean
    public void waitBaseStationTcpClient() {
        for (Map.Entry<Integer, Integer> mapEntry : baseStationTcpPorts.entrySet()) {
            try {
                ServerSocket serverCloudSocket = new ServerSocket(mapEntry.getKey());
                ServerSocket serverLocalSocket = new ServerSocket(mapEntry.getValue());
                BaseStationTcpClientSocketQueue socketQueue = new BaseStationTcpClientSocketQueue(serverCloudSocket,serverLocalSocket);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }


}
